<?php
declare(strict_types=1);
namespace SixShop\Payment\Entity;

use SixShop\Core\Entity\BaseEntity;
use SixShop\Payment\Model\ExtensionPaymentModel;
use think\Model;

/**
 * @mixin ExtensionPaymentModel
 */
class ExtensionPaymentEntity extends BaseEntity
{

    public function __construct(?Model $model = null)
    {
        parent::__construct($model);
    }

    public function read(int $id): self
    {
        $entity = $this->where('id', $id)->find();
        if (!$entity) {
            throw_logic_exception('支付记录不存在');
        }
        return $entity;
    }
}